<?php

require_once('../include/GeneralTop.php');
require('../include/class/db.php');

if (!$super_admin) {
	die('<div style="text-align:center">Permission denied...</div>');
}

$db = new db;
if ((isset($_POST["submit"]))) {
    if(MEMBER_SITE_ADMIN === (int)$_POST['member_type']) {
    	$role = MEMBER_SITE_ADMIN;
    }
    else if(MEMBER_PAID === (int)$_POST['member_type']) {
    	$role = MEMBER_PAID;
    }
    else if(5 === (int)$_POST['member_type'] && 5 === (int)$_POST['cgVolunteerType']) {
    	$role = MEMBER_CONTENT_ADMIN;
    }
    else {
    	$role = MEMBER_ORDINARY;
    }
    
    $check_username = "select member_id from member_info where member_login='".$_POST['txtMemberLogin']."' and member_id!='".$_POST['member_id']."'";
	$check_username_res = $db->query($check_username);
	$fail = false;
	if(0 < $db->num($check_username_res)) {
		$err = "会员网名已被注册，请换一个会员网名<br>";
		$fail = true;
	}
	
	$check_mail = "select member_id from member_info where Email_account='".$_POST['txtEmail']."' and member_id!='".$_POST['member_id']."'";
	$check_mail_res = $db->query($check_mail);
	if(0 < $db->num($check_mail_res)) {
		$err .= "Email地址已被使用，请换一个Email地址<br>";
		$fail = true;
	}
	
	if($fail) {
		die($err);
	}
	
	if(1 < count($_POST['cgVolunteerType'])) {
		$vol_type = '';
		foreach($_POST['cgVolunteerType'] as $_key => $_value) {
			$vol_type .= $_value.',';
		}
		$vol_type = substr($vol_type, 0, -1);
	}
	else {
		$vol_type = $_POST['cgVolunteerType'];
	}
    $updateSQL = sprintf("UPDATE member_info SET member_login=%s, member_name=%s, Sex=%s, Identity_id=%s, 
							Phone_number1=%s, Phone_number2=%s, Email_account=%s, Address=%s, Distict=%s, Zip=%s, 
							profession_type=%s, Pet_YN=%s, Pet_type=%s, Pet_breed=%s, Pet_count=%s, be_pay_member_YN=%s,
							Member_startDate=%s, Member_endDate=%s, Member_Status=%s, Member_type=%s, 
							Volunteer_YN=%s, Volunteer_Type=%s, Other_Volunteer=%s, foreign_language=%s, foster_fee_YN=%s, 
							foster_type=%s, foster_fee_amount=%s, interest_skills=%s, Experience=%s, role=%s, memo1=%s, memo2=%s  
							WHERE member_id=%s",
                       GetSQLValueString($_POST['txtMemberLogin'], "text"),
                       GetSQLValueString($_POST['txtMember_name'], "text"),
                       GetSQLValueString($_POST['sex'], "int"),
                       GetSQLValueString($_POST['txtIdentify_id'], "text"),
                       GetSQLValueString($_POST['txtTel'], "text"),
                       GetSQLValueString($_POST['txtMobile'], "text"),
                       GetSQLValueString($_POST['txtEmail'], "text"),
                       GetSQLValueString($_POST['txtAddress'], "text"),
                       GetSQLValueString($_POST['district'], "text"),
                       GetSQLValueString($_POST['zip'], "text"),
                       GetSQLValueString($_POST['profession'], "text"),
                       GetSQLValueString($_POST['ifhavepet'], "text"),
                       GetSQLValueString($_POST['pet_type'], "int"),
                       GetSQLValueString($_POST['pet_breed'], "text"),
                       GetSQLValueString($_POST['pet_amount'], "text"),                       
                       GetSQLValueString($_POST['want_be_pay'], "int"),
                       GetSQLValueString($_POST['member_start_date'], "text"),
                       GetSQLValueString($_POST['member_end_date'], "text"),
                       GetSQLValueString($_POST['member_status'], "int"),
                       GetSQLValueString($_POST['member_type'], "int"),
                       GetSQLValueString($_POST['want_be_vo'], "int"),
                       GetSQLValueString($vol_type, "text"),
                       GetSQLValueString($_POST['other_vo'], "text"),
                       GetSQLValueString($_POST['english_ability'], "text"),
                       GetSQLValueString($_POST['free_foster'], "text"),
                       GetSQLValueString($_POST['foster_type'], "text"),
                       GetSQLValueString($_POST['txtFee'], "text"),
                       GetSQLValueString($_POST['tfHobby'], "text"),
                       GetSQLValueString($_POST['tfExperince'], "text"),
                       GetSQLValueString($role, "int"),
                       GetSQLValueString($_POST['memo1'], "text"),
                       GetSQLValueString($_POST['memo2'], "text"),
                       GetSQLValueString($_POST['member_id'], "int"));
	//echo $updateSQL;
    $db->query($updateSQL);
    
    if($_POST['txtPassword'] != '') {
    	$update_password = "update member_info set password='".md5($_POST['txtPassword'])."' where member_id=".$_POST['member_id'];
    	$db->query($update_password);
    }
    header("location:".$_SERVER['PHP_SELF']."?result=suc&member_id=".$_POST['member_id']);
}

$id = "-1";
if (isset($_GET['member_id'])) {
  $id = $_GET['member_id'];
}

$sql = sprintf("SELECT * FROM member_info WHERE member_id = %s", GetSQLValueString($id, "int"));
$res = $db->query($sql);
$row = $db->fetch($res);

include('AdminPanel.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" onsubmit="return check_form();">
  <table align="center" width="600" border="0" cellpadding="5" cellspacing="1">
    <?php
    if($_GET['result'] && 'suc' == $_GET['result']) {
    ?>
    <tr valign="baseline">
      <td colspan="2" nowrap="nowrap" align="center"><font color="green">更新成功...</font></td>
    </tr>
    <?php
    }
    ?>
    <tr>
      <td align="right"><strong>修改会员资料: </strong></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row"><font color="red">*</font> 会员网名</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="text" name="txtMemberLogin" id="txtMemberLogin" value="<?php echo htmlentities($row['member_login'], ENT_COMPAT, 'utf-8')?>"/>
      </label></td>
      <td width="118">&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">密码</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="password" name="txtPassword" id="txtPassword" /> (留空就是不改)
      </label></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row"><font color="red">*</font> 会员真实名字</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="text" name="txtMember_name" id="ActualName" value="<?php echo htmlentities($row['member_name'], ENT_COMPAT, 'utf-8');?>"/>
      </label></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">性别</th>
      <td width="75%" align="left" valign="middle"><p>
      <?php
      if(MEMBER_MALE === (int)$row['Sex']) {
      	  $male_check = 'checked';
      	  $female_check = '';
      }
      else {
      	  $male_check = '';
      	  $female_check = 'checked';
      }
      ?>
          <label>
            <span id="rgGender_0">
			<input type="radio" name="sex" value="<?php echo MEMBER_MALE?>" id="rgGender_0" <?php echo $male_check?>/>
			男</span></label>
          <span id="rgGender_">
          <label>
            <input type="radio" name="sex" value="<?php echo MEMBER_FEMALE?>" id="rgGender_1" <?php echo $female_check?>/>
           	 女</label>
      </span></p></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">身份证号</th>
      <td width="75%" align="left" valign="middle"><input name="txtIdentify_id" type="text" id="ActualName2" maxlength="18" value="<?php echo htmlentities($row['Identity_id'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">固定电话</th>
      <td width="75%" align="left" valign="middle"><input name="txtTel" type="text" id="ActualName3" maxlength="20"  value="<?php echo htmlentities($row['Phone_number1'], ENT_COMPAT, 'utf-8')?>"/></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row"><font color="red">*</font> 联系手机</th>
      <td width="75%" align="left" valign="middle"><input name="txtMobile" type="text" id="ActualName4" maxlength="20" value="<?php echo htmlentities($row['Phone_number2'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row"><font color="red">*</font> 邮件地址</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="txtEmail" id="ActualName5" value="<?php echo htmlentities($row['Email_account'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">住家地址</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="txtAddress" id="ActualName6" value="<?php echo htmlentities($row['Address'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row"><font color="red">*</font> 上海区县</th>
      <td width="75%" align="left" valign="middle"><select name="district" id="select3">
        <option value="">-请选择-</option>
        <?php
        foreach($district_arr as $_key => $_value) {
        	if($_value == $row['Distict']) {
        		echo '<option value="'.$_value.'" selected>'.$_value.'</option>';
        	}
        	else {
        		echo '<option value="'.$_value.'">'.$_value.'</option>';
        	}
        }        
        ?>
      </select></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">邮政编码</th>
      <td width="75%" align="left" valign="middle"><input name="zip" type="text" id="ActualName7" maxlength="10" value="<?php echo htmlentities($row['Zip'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">职业类型</th>
      <td width="75%" align="left" valign="middle"><label>
        <select name="profession" id="select">
            <option value="">-请选择-</option>
            <?php
	        foreach($profession_arr as $_key => $_value) {
	        	if($_value == $row['profession_type']) {
	        		echo '<option value="'.$_value.'" selected>'.$_value.'</option>';
	        	}
	        	else {
	        		echo '<option value="'.$_value.'">'.$_value.'</option>';
	        	}
	        }        
	        ?>
        </select>
      </label></td>
      <td>&nbsp;</td>
    </tr>
    <?php
      if('Y' == $row['Pet_YN']) {
      	  $yes = 'checked';
      	  $no = '';
      }
      else {
      	  $yes = 'checked';
      	  $no = 'checked';
      }
      ?>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">家中是否饲养宠物？</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="radio" name="ifhavepet" value="Y" id="rgGender_2" <?php echo $yes?>/>
        是
      </label>
        <label>
          <input type="radio" name="ifhavepet" value="N" id="rgGender_3" <?php echo $no?> />
      否</label></td>
      <td>&nbsp;</td>
    </tr>
    <?php
      if(1 === (int)$row['Pet_type']) {
      	  $dog = 'checked';
      	  $cat = '';
      	  $other = '';
      	  $both = '';
      }
      else if(2 === (int)$row['Pet_type']) {
      	  $dog = '';
      	  $cat = 'checked';
      	  $other = '';
      	  $both = '';
      }
      else if(3 === (int)$row['Pet_type']) {
      	  $dog = '';
      	  $cat = '';
      	  $other = 'checked';
      	  $both = '';
      }
      else {
      	  $dog = '';
      	  $cat = '';
      	  $other = '';
      	  $both = 'checked';
      }
      ?>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">饲养何种宠物？</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="radio" name="pet_type" value="<?php echo PET_TYPE_CAT?>" id="rgGender_4" <?php echo $cat?>/>
        猫</label>
        <label>
          <input type="radio" name="pet_type" value="<?php echo PET_TYPE_DOG?>" id="rgGender_5" <?php echo $dog?>/>
      狗</label>
      <input type="radio" name="pet_type" value="<?php echo PET_TYPE_BOTH?>" id="rgGender_5"  <?php echo $both?>/>
      猫狗都有</label>
      <input type="radio" name="pet_type" value="<?php echo PET_TYPE_OTHER?>" id="rgGender_5" <?php echo $other?>/>
      其他</label></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">宠物品种</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="pet_breed" id="ActualName8" value="<?php echo htmlentities($row['Pet_breed'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">宠物总数</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="pet_amount" id="ActualName9" value="<?php echo htmlentities($row['Pet_count'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">成为会员时间</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="member_start_date" id="ActualName10" value="<?php echo htmlentities($row['Member_startDate'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">从付费起一年</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="member_end_date" id="ActualName11" value="<?php echo htmlentities($row['Member_endDate'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row"><p>会员状态</p></th>
      <td width="75%" align="left" valign="middle">
      <?php
      if(1 === (int)$row['Member_Status']) {
      	  $status1 = 'selected';
      	  $status2 = '';
      	  $status3 = '';
      	  $status4 = '';
      }
      else if(2 === (int)$row['Member_Status']) {
      	  $status1 = '';
      	  $status2 = 'selected';
      	  $status3 = '';
      	  $status4 = '';
      }
      else if(3 === (int)$row['Member_Status']) {
      	  $status1 = '';
      	  $status2 = '';
      	  $status3 = 'selected';
      	  $status4 = '';
      }
      else {
      	  $status1 = '';
      	  $status2 = '';
      	  $status3 = '';
      	  $status4 = 'selected';
      }
      ?>
      	<select name="member_status">
      <?php
      foreach($member_status_arr as $_key => $_value) {
    	  if((int)$_key === (int)$row['Member_Status']) {
    	  	  echo '<option value="'.$_key.'" selected>'.$_value.'</option>';
    	  }
    	  else {
    	  	  echo '<option value="'.$_key.'">'.$_value.'</option>';
    	  }
      }
	  ?>
      	</select>
      </td>
      <td>&nbsp;</td>
    </tr>
    <?php
      if(1 === (int)$row['Member_type']) {
      	  $admin = 'checked';
      	  $pay = '';
      	  $vol = '';
      	  $ordinary = '';
      }
      else if(2 === (int)$row['Member_type']) {
      	  $admin = '';
      	  $pay = 'checked';
      	  $vol = '';
      	  $ordinary = '';
      }
      else if(5 === (int)$row['Member_type']) {
      	  $admin = '';
      	  $pay = '';
      	  $vol = 'checked';
      	  $ordinary = '';
      }
      else {
      	  $admin = '';
      	  $pay = '';
      	  $vol = '';
      	  $ordinary = 'checked';
      }
      ?>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">会员类型</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="radio" name="member_type" value="<?php echo MEMBER_ORDINARY?>" id="rgGender_14" <?php echo $ordinary?> />
        普通会员</label>
        <label>
        <input type="radio" name="member_type" value="<?php echo MEMBER_VOL?>" id="rgGender_14" <?php echo $vol?> />
        志愿者</label>
        <label>
          <input type="radio" name="member_type" value="<?php echo MEMBER_PAID?>" id="rgGender_15" <?php echo $pay?>/>
      付费会员</label>
      <label>
          <input type="radio" name="member_type" value="<?php echo MEMBER_SITE_ADMIN?>" id="rgGender_15" <?php echo $admin?>/>
      管理员</label>
      </td>
      <td>&nbsp;</td>
    </tr>
    <?php
      if(1 === (int)$row['be_pay_member_YN']) {
      	  $yes = 'checked';
      	  $no = '';
      }
      else if(2 === (int)$row['be_pay_member_YN']) {
      	  $yes = '';
      	  $no = 'checked';
      }
      ?>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">是否愿意成为付费会员</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="radio" name="want_be_pay" value="1" id="rgGender_6" <?php echo $yes?>/>
        愿意
      </label>
        <label>
          <input type="radio" name="want_be_pay" value="2" id="rgGender_7" <?php echo $no?>/>
          不愿意
        </label></td>
      <td>&nbsp;</td>
    </tr>
    <?php
      if(1 === (int)$row['Volunteer_YN']) {
      	  $yes = 'checked';
      	  $no = '';
      }
      else if(2 === (int)$row['Volunteer_YN']) {
      	  $yes = '';
      	  $no = 'checked';
      }
      ?>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">是否愿意成为志愿者</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="radio" name="want_be_vo" value="1" id="rgGender_6" <?php echo $yes?>/>
        愿意
      </label>
        <label>
          <input type="radio" name="want_be_vo" value="2" id="rgGender_7" <?php echo $no?>/>
          不愿意
        </label></td>
      <td>&nbsp;</td>
    </tr>
    <?php
      $type1 = '';
  	  $type2 = '';
  	  $type3 = '';
  	  $type4 = '';
  	  $type5 = '';
  	  $type6 = '';
  	  $vol_type = explode(",", $row['Volunteer_Type']);
      if(in_array(1, $vol_type)) {
      	  $type1 = 'checked';
      }
      if(in_array(2, $vol_type)) {
      	  $type2 = 'checked';
      }
      if(in_array(3, $vol_type)) {
      	  $type3 = 'checked';
      }
      if(in_array(4, $vol_type)) {
      	  $type4 = 'checked';
      }
      if(in_array(5, $vol_type)) {
      	  $type5 = 'checked';
      }
      if(in_array(6, $vol_type)) {
      	  $type6 = 'checked';
      }
      ?>
    <tr>
      <th width="25%" align="right" valign="top" scope="row">志愿者类型</th>
      <td width="75%" align="left" valign="middle"><p>
        <label>
          <input type="checkbox" name="cgVolunteerType[]" id="cgVolunteerType_0" value="1" <?php echo $type1?>/>
          <?php echo TEXT_VOLUNTEER_TYPE_1?></label>
        <br />
        <label>
          <input type="checkbox" name="cgVolunteerType[]" id="cgVolunteerType_1" value="2" <?php echo $type2?>/>
          <?php echo TEXT_VOLUNTEER_TYPE_2?></label>
        <br />
        <label>
          <input type="checkbox" name="cgVolunteerType[]" id="cgVolunteerType_0" value="3" <?php echo $type3?>/>
          <?php echo TEXT_VOLUNTEER_TYPE_3?></label>
        <br />
        <label>
          <input type="checkbox" name="cgVolunteerType[]" id="cgVolunteerType_0" value="4" <?php echo $type4?>/>
          <?php echo TEXT_VOLUNTEER_TYPE_4?></label>
        <br />
        <label>
          <input type="checkbox" name="cgVolunteerType[]" id="cgVolunteerType_0" value="5" <?php echo $type5?>/>
          <?php echo TEXT_VOLUNTEER_TYPE_5?></label>
        <br />
        <label>
          <input type="checkbox" name="cgVolunteerType[]" id="cgVolunteerType_0" value="6" <?php echo $type6?>/>
          <?php echo TEXT_VOLUNTEER_TYPE_6?></label>
        <br />
        <br />
      </p></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">其它志愿者</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="other_vo" id="ActualName12" value="<?php echo htmlentities($row['Other_Volunteer'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">外语能力</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="english_ability" value="<?php echo htmlentities($row['foreign_language'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <?php
      if(1 === (int)$row['foster_fee_YN']) {
      	  $yes = 'checked';
      	  $no = '';
      }
      else if(2 === (int)$row['foster_fee_YN']) {
      	  $yes = '';
      	  $no = 'checked';
      }
      ?>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">如果可提供寄养，是否可免费寄养</th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="radio" name="free_foster" value="<?php echo FREE_FOSTER_YES?>" id="rgGender_10" <?php echo $yes?>/>
        愿意</label>
        <label>
          <input type="radio" name="free_foster" value="<?php echo FREE_FOSTER_NO?>" id="rgGender_11" <?php echo $yes?>/>
      不愿意</label></td>
      <td>&nbsp;</td>
    </tr>
    <?php
      if(1 === (int)$row['foster_type']) {
      	  $dog = 'checked';
      	  $cat = '';
      	  $both = '';
      }
      else if(2 === (int)$row['foster_type']) {
      	  $dog = '';
      	  $cat = 'checked';
      	  $both = '';
      }
      else {
      	  $dog = '';
      	  $cat = '';
      	  $both = 'checked';
      }
      ?>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row"><p>可寄养何种宠物？</p></th>
      <td width="75%" align="left" valign="middle"><label>
        <input type="radio" name="foster_type" value="<?php echo PET_TYPE_CAT?>" id="rgGender_12" <?php echo $cat?>/>
        猫</label>
        <label>
          <input type="radio" name="foster_type" value="<?php echo PET_TYPE_DOG?>" id="rgGender_13" <?php echo $dog?>/>
      狗</label>
      <input type="radio" name="foster_type" value="<?php echo PET_TYPE_BOTH?>" id="rgGender_5"  <?php echo $both?>/>
      猫狗都可以</label>
      </td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">如果要有偿寄养，收费是多少？</th>
      <td width="75%" align="left" valign="middle"><input type="text" name="txtFee" id="ActualName13" value="<?php echo htmlentities($row['foster_fee_amount'], ENT_COMPAT, 'utf-8')?>" /></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">兴趣/专长</th>
      <td width="75%" align="left" valign="middle"><label>
        <textarea name="tfHobby" id="tfHobby" cols="45" rows="5"><?php echo htmlentities($row['interest_skills'], ENT_COMPAT, 'utf-8')?></textarea>
      </label></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">工作/义工/动物方面的经验</th>
      <td width="75%" align="left" valign="middle"><textarea name="tfExperince" id="tfExperince" cols="45" rows="5"><?php echo htmlentities($row['Experience'], ENT_COMPAT, 'utf-8')?></textarea></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">管理员备忘1</th>
      <td width="75%" align="left" valign="middle"><textarea name="memo1" id="memo1" cols="45" rows="5"><?php echo htmlentities($row['memo1'], ENT_COMPAT, 'utf-8')?></textarea></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th width="25%" align="right" valign="middle" scope="row">管理员备忘2</th>
      <td width="75%" align="left" valign="middle"><textarea name="memo2" id="memo2" cols="45" rows="5"><?php echo htmlentities($row['memo2'], ENT_COMPAT, 'utf-8')?></textarea></td>
      <td>&nbsp;</td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" name="submit" id="submit" value="Update record" /></td>
    </tr>
    <tr valign="baseline">
      <td colspan="2" align="center" nowrap="nowrap"><font color="red"><?php echo $_POST['Status']; ?></font></td>
    </tr>
  </table>
  <input type="hidden" name="member_id" value="<?php echo $row['member_id']; ?>" />
</form>
<p>&nbsp;</p>
</body>
</html>

<script language="JavaScript" type="text/javascript">
function check_form() {
	if (document.getElementById('txtMemberLogin').value == '') {
		alert('会员网名 is invalid');
		document.getElementById('txtMemberLogin').focus();
		return false;
	}
	if (document.getElementById('ActualName').value == '') {
		alert('真实姓名 is invalid');
		document.getElementById('ActualName').focus();
		return false;
	}
	if (document.getElementById('ActualName4').value == '') {
		alert('手机 is invalid');
		document.getElementById('ActualName4').focus();
		return false;
	}
	if (document.getElementById('ActualName5').value == '') {
		alert('邮件地址 is invalid');
		document.getElementById('ActualName5').focus();
		return false;
	}
	if (document.getElementById('ActualName5').value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
		alert('邮件地址格式不正确');
		document.getElementById('ActualName5').focus();
		return false;
	}
	if (document.getElementById('select3').value == '') {
		alert('区县 is invalid');
		document.getElementById('select3').focus();
		return false;
	}
	
	return true;
}
</script>